package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MesOnlineconfirmCgzx;
import com.ruoyi.system.service.IMesOnlineconfirmCgzxService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 城轨轴箱配送确认 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-02-22
 */
@Controller
@RequestMapping("/system/mesOnlineconfirmCgzx")
public class MesOnlineconfirmCgzxController extends BaseController
{
    private String prefix = "system/mesOnlineconfirmCgzx";
	
	@Autowired
	private IMesOnlineconfirmCgzxService mesOnlineconfirmCgzxService;
	
	@RequiresPermissions("system:mesOnlineconfirmCgzx:view")
	@GetMapping()
	public String mesOnlineconfirmCgzx()
	{
	    return prefix + "/mesOnlineconfirmCgzx";
	}
	
	/**
	 * 查询城轨轴箱配送确认列表
	 */
	@RequiresPermissions("system:mesOnlineconfirmCgzx:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(MesOnlineconfirmCgzx mesOnlineconfirmCgzx)
	{
		startPage();
        List<MesOnlineconfirmCgzx> list = mesOnlineconfirmCgzxService.selectMesOnlineconfirmCgzxList(mesOnlineconfirmCgzx);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出城轨轴箱配送确认列表
	 */
	@RequiresPermissions("system:mesOnlineconfirmCgzx:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MesOnlineconfirmCgzx mesOnlineconfirmCgzx)
    {
    	List<MesOnlineconfirmCgzx> list = mesOnlineconfirmCgzxService.selectMesOnlineconfirmCgzxList(mesOnlineconfirmCgzx);
        ExcelUtil<MesOnlineconfirmCgzx> util = new ExcelUtil<MesOnlineconfirmCgzx>(MesOnlineconfirmCgzx.class);
        return util.exportExcel(list, "mesOnlineconfirmCgzx");
    }
	
	/**
	 * 新增城轨轴箱配送确认
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存城轨轴箱配送确认
	 */
	@RequiresPermissions("system:mesOnlineconfirmCgzx:add")
	@Log(title = "城轨轴箱配送确认", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(MesOnlineconfirmCgzx mesOnlineconfirmCgzx)
	{		
		return toAjax(mesOnlineconfirmCgzxService.insertMesOnlineconfirmCgzx(mesOnlineconfirmCgzx));
	}

	/**
	 * 修改城轨轴箱配送确认
	 */
	@GetMapping("/edit/{gid}")
	public String edit(@PathVariable("gid") String gid, ModelMap mmap)
	{
		MesOnlineconfirmCgzx mesOnlineconfirmCgzx = mesOnlineconfirmCgzxService.selectMesOnlineconfirmCgzxById(gid);
		mmap.put("mesOnlineconfirmCgzx", mesOnlineconfirmCgzx);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存城轨轴箱配送确认
	 */
	@RequiresPermissions("system:mesOnlineconfirmCgzx:edit")
	@Log(title = "城轨轴箱配送确认", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(MesOnlineconfirmCgzx mesOnlineconfirmCgzx)
	{		
		return toAjax(mesOnlineconfirmCgzxService.updateMesOnlineconfirmCgzx(mesOnlineconfirmCgzx));
	}
	
	/**
	 * 删除城轨轴箱配送确认
	 */
	@RequiresPermissions("system:mesOnlineconfirmCgzx:remove")
	@Log(title = "城轨轴箱配送确认", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(mesOnlineconfirmCgzxService.deleteMesOnlineconfirmCgzxByIds(ids));
	}
	
}
